import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'
import Register from '../views/Register.vue'
import Table from '../views/Table.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Login',
    redirect:'/login',
  },
  {
	path:'/table',
	name:'table',
    componet:Table
  },
  {
    path: '/login',
    name: 'Login',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/Login.vue')
  },
  {
	  path: '/register',
	  name: 'Register',
	  component: Register
  },
  {
    path: '/index',
    name: 'Index',
    
    component: () => import('../views/index.vue')
  },
  {
    path: '/botnav',
    name: 'Botnav',
    
    component: () => import('../views/Botnav.vue'),
	children:[
	  {
	    path: 'index',
	    name: 'index',
	    component: () => import('../views/index.vue')
	  },
	  {
	    path: 'list',
	    name: 'list',
	    component: () => import('../views/List.vue')
	  },
	  {
	    path: 'search',
	    name: 'search',
	    component: () => import('../views/Search.vue')
	  },
	  {
	    path: 'cart',
	    name: 'cart',
	    component: () => import('../views/Cart.vue'),
		meta:{
		  requireAuth:true,//当有这个字段的时候，我们就认为他这个路由页面是要有登录权限的
		}
	  },
	  {
	    path: 'mine',
	    name: 'mine',
	    component: () => import('../views/Mine.vue'),
		meta:{
		  requireAuth:true,//当有这个字段的时候，我们就认为他这个路由页面是要有登录权限的
		}
	  },
	]
  }
	]
  


const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
